package mobi.greenplate.theweb.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import mobi.greenplate.theweb.domain.Location;


@XmlRootElement(name="location-list")
public class LocationListConverter {

    private final List<Location> entities;

    public LocationListConverter() {
        this.entities=new ArrayList<Location>();
    }
    
    public LocationListConverter(List<Location> entities) {
        this.entities = entities;
    }

    @XmlElement
    public List<LocationConverter> getLocation(){
        final List<LocationConverter> list = new ArrayList<LocationConverter>();
        for (Location location : entities) {
            list.add(new LocationConverter(location));
        }
        return list;
    }

    @XmlTransient
    public List<Location> getEntities(){
        return Collections.unmodifiableList(this.entities);
    }

}


